home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8"?>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:output method="xml" indent="yes"/>
- <xsl:template name="Split">
- <!--This template will recursively break apart a comma-delimited string into child elements-->
- <xsl:param name="strInput" select="''"/>
- <xsl:param name="strDelimiter" select="','"/>
- <xsl:variable name="strNextItem" select="substring-before($strInput, $strDelimiter)"/>
- <xsl:variable name="strOutput" select="substring-after($strInput, $strDelimiter)"/>
- <xsl:variable name="strLen" select="string-length($strNextItem)"/>
- <xsl:choose>
- <xsl:when test="contains($strInput,$strDelimiter)">
- <computerlanguage>
- <xsl:value-of select="$strNextItem"/>
- </computerlanguage>
- <!-- At this point, the template will recursively call itself until the last comma is found -->
- <xsl:call-template name="Split">
- <xsl:with-param name="strInput" select="$strOutput"/>
- <xsl:with-param name="strDelimiter" select="$strDelimiter"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <!-- The otherwise clause will be reached when a comma is not located using contains() -->
- <computerlanguage>
- <xsl:value-of select="$strInput"/>
- </computerlanguage>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- </xsl:stylesheet>
-